<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>图书管理</title>
	<%--	静态包含base标签，css样式,jQuer文件--%>
	<%@include file="/pages/common/head.jsp"%>
	<link type="text/css" rel="stylesheet" href="static/layui/css/layui.css" >
	<script type="text/javascript">
		$(function () {
			/**
			 * confirm是确认提示框函数
			 * 参数是它的提示内容，一个确认，一个取消
			 * 返回true表示点击了确认，返回false表示点击了取消
			 */
			$("a.deleteClass").click(function () {
				return confirm("你确定要删除["+$(this).parent().parent().find("td:first").text()+"]？");
				//return false表示阻止元素的默认行为，不提交请求
			})
		})
	</script>
</head>
<body >
	
	<div id="header">
			<img class="logo_img" alt="" src="../../static/img/logo.gif" >
			<span class="wel_word">图书管理系统</span>
		<%--		静态包含manager页面的菜单--%>
		<%@include file="/pages/common/manager_menu.jsp"%>
	</div>
	
	<div id="main" style="width: 60%;height: 610px ;margin-left: 20%" class="layui-anim-down">
		<table class="layui-table">
			<tr>
				<td>名称</td>
				<td>价格</td>
				<td>作者</td>
				<td>销量</td>
				<td>库存</td>
				<td colspan="2">操作</td>
			</tr>
			<c:forEach items="${requestScope.page.items}" var="book">
				<tr>
					<td>${book.name}</td>
					<td>${book.price}</td>
					<td>${book.author}</td>
					<td>${book.sales}</td>
					<td>${book.stock}</td>
					<td><a href="manager/bookServlet?action=getBook&id=${book.id}&pageNo=${requestScope.page.pageNo}" class="layui-btn layui-btn-sm">修改</a></td>
					<td><a href="manager/bookServlet?action=delete&id=${book.id}&pageNo=${requestScope.page.pageNo}" class="layui-btn layui-btn-danger  layui-btn-sm deleteClass"  >删除</a></td>
				</tr>
			</c:forEach>



			<tr>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td><a href="pages/manager/book_edit.jsp?pageNo=${requestScope.page.pageTotal}">添加图书</a></td>
			</tr>	
		</table>
		<%--静态包含分页条--%>
		<%@include file="/pages/common/page_nav.jsp"%>

	</div>

	<%--	静态包含页脚--%>
	<%@include file="/pages/common/footer.jsp"%>
</body>
</html>